<template lang="html">
    <div class="revisePassword">
        <img src="../../assets/images/logo-head.png" alt="" class="logo-img">
       <el-form labelWidth="80px" v-model="formData">
            <el-form-item label="手机号">
                <el-input placeholder="请输入注册手机号" v-model="formData.phone"></el-input>
            </el-form-item>
            <el-form-item label="原密码">
                <el-input placeholder="请输入原密码" type="password" v-model="formData.password"></el-input>
            </el-form-item>
            <el-form-item label="新密码">
                <el-input placeholder="请输入新密码" type="password" v-model="formData.newPassWord"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" class="el-button" @click="resetPassword">确 定</el-button>
            </el-form-item>
       </el-form>
    </div>
</template>

<script>
import axo from "@/assets/js/axo";
export default {
    data() {
        return {
            formData: {}
        };
    },
    methods: {
        resetPassword () {
            console.log(this.formData);
            axo({
                method: 'post',
                url: '/api-sys/user/editPassWord',
                data: {
                    "platformNo": "1",
                    "body": {
                        phone: this.formData.phone,
                        password: this.formData.password,
                        newPassWord: this.formData.newPassWord
                    }
                }
            }).then((res) => {
                console.log(res);
                if(res.data.state.code === "200"){
                    this.$message({
                        message: this.editType+'成功',
                        type: 'success',
                        duration: 800
                    });
                    this.dialog = false;
                    this.loadData(this.searchItem.name, this.pageNum, this.pageSize);
                }else{
                    this.$message({
                        message: res.data.state.message,
                        type: 'error',
                        duration: 800
                    });
                }
            });
        }
    }
};
</script>

<style lang="scss" scoped>
    .revisePassword{
        width: 100%;
        height: 100%;
        overflow: hidden;
        .logo-img{
            display: block;
            margin:200px auto 20px;
        }
        .el-form{
            width: 300px;
            height: auto;
            margin:0 auto;
            padding-right: 80px;
            .forget-password{
                float: right;
                margin-bottom:20px;
                color: #1d90e6;
                font-size:12px;
            }
            .el-form-item{
                .el-button{
                    width: 223px;
                }
            }
        }
    }
</style>
